#include "Result.h"


Result::Result(int grade)
{
}
Result::Result(Result & r)
{
	this->grade = r.getGrade();
}
void Result::read(){
	cin.ignore(INT_MAX,'\n');
	
	string s = "Skriv in sifferbetyget\n";
	cout << s;
	char grade[6];
	cin >> grade;
	this->grade = atoi(grade);

}

Result::~Result(void)
{
}
	ostream& operator<< (ostream& o, Result& s){
		o << s.getGrade();
		return o;
	}
	istream& operator>>(istream& i, Result& s){
	if (i.peek()=='\n')
		i.ignore(1);
	char input[100];
	stringstream ss;
	bool eof = false;
	int count = 0;
	char x = ' ';
	char grade[5];
	while((i.peek()!='\n') && (i.peek() != -52) && (i>>x)){
		input[count++] = x;
	}
	char resultData[2000];
	input[count++] = '\n';
	sscanf(input,"%s", grade);

	s.setGrade(atoi(grade));

	return i;
	}